package edu.gznu.ics.fast.pulsar.controller.prestoacc.picController;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import edu.gznu.ics.fast.pulsar.model.vo.prestoacc.task.computeTask.TaskMonitorDetailHeaderVO;
import edu.gznu.ics.fast.pulsar.model.vo.prestoacc.task.computeTask.TaskMonitorDetailItemVO;
import edu.gznu.ics.fast.pulsar.service.prestoacc.picService.TaskMonitorDetailService;

@Controller
public class TaskMonitorDetailController {
	
	@Autowired
	private TaskMonitorDetailService taskMonitorDetailService;
	
	@RequestMapping(value = {"task_monitor_detail.do"})
	public ModelAndView taskMonitorDetail(
			@RequestParam(value = "file_id", required = true) int fileId,
			@RequestParam(value = "task_id", required = true) int taskId) {
		TaskMonitorDetailHeaderVO headerVO = taskMonitorDetailService.findHeader(fileId, taskId);
		List<TaskMonitorDetailItemVO> itemList = taskMonitorDetailService.findListByFileIdAndTaskId(fileId, taskId);
		ModelAndView view = new ModelAndView();
		view.setViewName("/task_monitor_detail");
		view.addObject("headerVO", headerVO);
		view.addObject("itemList", itemList);
		return view;
	}
}
